home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xmlextras / nsIXMLHttpRequest.h < prev   
C/C++ Source or Header  |  2006-05-08  |  30KB  |  739 lines

  1. /*
  2.  * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIXMLHttpRequest.idl
  3.  */
  4.  
  5. #ifndef __gen_nsIXMLHttpRequest_h__
  6. #define __gen_nsIXMLHttpRequest_h__
  7.  
  8.  
  9. #ifndef __gen_nsISupports_h__
  10. #include "nsISupports.h"
  11. #endif
  12.  
  13. /* For IDL files that don't want to include root IDL files. */
  14. #ifndef NS_NO_VTABLE
  15. #define NS_NO_VTABLE
  16. #endif
  17. class nsIDOMDocument; /* forward declaration */
  18.  
  19. class nsIDOMEventListener; /* forward declaration */
  20.  
  21. class nsIChannel; /* forward declaration */
  22.  
  23. class nsIVariant; /* forward declaration */
  24.  
  25.  
  26. /* starting interface:    nsIXMLHttpRequest */
  27. #define NS_IXMLHTTPREQUEST_IID_STR "7b3b3c62-9d53-4abc-bc89-c33ce78f439f"
  28.  
  29. #define NS_IXMLHTTPREQUEST_IID \
  30.   {0x7b3b3c62, 0x9d53, 0x4abc, \
  31.     { 0xbc, 0x89, 0xc3, 0x3c, 0xe7, 0x8f, 0x43, 0x9f }}
  32.  
  33. /**
  34.  * Mozilla's XMLHttpRequest is modelled after Microsoft's IXMLHttpRequest
  35.  * object. The goal has been to make Mozilla's version match Microsoft's
  36.  * version as closely as possible, but there are bound to be some differences.
  37.  *
  38.  * In general, Microsoft's documentation for IXMLHttpRequest can be used.
  39.  * Mozilla's interface definitions provide some additional documentation. The
  40.  * web page to look at is http://www.mozilla.org/xmlextras/
  41.  *
  42.  * Mozilla's XMLHttpRequest object can be created in JavaScript like this:
  43.  *   new XMLHttpRequest()
  44.  * compare to Internet Explorer:
  45.  *   new ActiveXObject("Msxml2.XMLHTTP")
  46.  *
  47.  * From JavaScript, the methods and properties visible in the XMLHttpRequest
  48.  * object are a combination of nsIXMLHttpRequest and nsIJSXMLHttpRequest;
  49.  * there is no need to differentiate between those interfaces.
  50.  *
  51.  * From native code, the way to set up onload and onerror handlers is a bit
  52.  * different. Here is a comment from Johnny Stenback <jst@netscape.com>:
  53.  *
  54.  *   The mozilla implementation of nsIXMLHttpRequest implements the interface
  55.  *   nsIDOMEventTarget and that's how you're supported to add event listeners.
  56.  *   Try something like this:
  57.  *
  58.  *   nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(myxmlhttpreq));
  59.  *
  60.  *   target->AddEventListener(NS_LITERAL_STRING("load"), mylistener,
  61.  *                            PR_FALSE)
  62.  *
  63.  *   where mylistener is your event listener object that implements the
  64.  *   interface nsIDOMEventListener.
  65.  *
  66.  *   The 'onload' and 'onerror' attributes moved to nsIJSXMLHttRequest,
  67.  *   but if you're coding in C++ you should avoid using those.
  68.  */
  69. class NS_NO_VTABLE nsIXMLHttpRequest : public nsISupports {
  70.  public: 
  71.  
  72.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IXMLHTTPREQUEST_IID)
  73.  
  74.   /**
  75.    * The request uses a channel in order to perform the
  76.    * request.  This attribute represents the channel used
  77.    * for the request.  NULL if the channel has not yet been
  78.    * created.
  79.    *
  80.    * In a multipart request case, this is the initial channel, not the
  81.    * different parts in the multipart request.
  82.    *
  83.    * Mozilla only. Requires elevated privileges to access.
  84.    */
  85.   /* readonly attribute nsIChannel channel; */
  86.   NS_IMETHOD GetChannel(nsIChannel * *aChannel) = 0;
  87.  
  88.   /**
  89.    * The response to the request is parsed as if it were a
  90.    * text/xml stream. This attributes represents the response as
  91.    * a DOM Document object. NULL if the request is unsuccessful or
  92.    * has not yet been sent.
  93.    */
  94.   /* readonly attribute nsIDOMDocument responseXML; */
  95.   NS_IMETHOD GetResponseXML(nsIDOMDocument * *aResponseXML) = 0;
  96.  
  97.   /**
  98.    * The response to the request as text.
  99.    * NULL if the request is unsuccessful or
  100.    * has not yet been sent.
  101.    */
  102.   /* readonly attribute AString responseText; */
  103.   NS_IMETHOD GetResponseText(nsAString & aResponseText) = 0;
  104.  
  105.   /**
  106.    * The status of the response to the request for HTTP requests.
  107.    */
  108.   /* readonly attribute unsigned long status; */
  109.   NS_IMETHOD GetStatus(PRUint32 *aStatus) = 0;
  110.  
  111.   /**
  112.    * The string representing the status of the response for
  113.    * HTTP requests.
  114.    */
  115.   /* readonly attribute AUTF8String statusText; */
  116.   NS_IMETHOD GetStatusText(nsACString & aStatusText) = 0;
  117.  
  118.   /**
  119.    * If the request has been sent already, this method will
  120.    * abort the request.
  121.    */
  122.   /* void abort (); */
  123.   NS_IMETHOD Abort(void) = 0;
  124.  
  125.   /**
  126.    * Returns all of the response headers as a string for HTTP
  127.    * requests.
  128.    *
  129.    * Note that this will return all the headers from the *current*
  130.    * part of a multipart request, not from the original channel.
  131.    *
  132.    * @returns A string containing all of the response headers.
  133.    *          NULL if the response has not yet been received.
  134.    */
  135.   /* string getAllResponseHeaders (); */
  136.   NS_IMETHOD GetAllResponseHeaders(char **_retval) = 0;
  137.  
  138.   /**
  139.    * Returns the text of the header with the specified name for
  140.    * HTTP requests.
  141.    *
  142.    * @param header The name of the header to retrieve
  143.    * @returns A string containing the text of the header specified.
  144.    *          NULL if the response has not yet been received or the
  145.    *          header does not exist in the response.
  146.    */
  147.   /* ACString getResponseHeader (in AUTF8String header); */
  148.   NS_IMETHOD GetResponseHeader(const nsACString & header, nsACString & _retval) = 0;
  149.  
  150.   /**
  151.    * Native (non-script) method to initialize a request. Note that
  152.    * the request is not sent until the <code>send</code> method
  153.    * is invoked.
  154.    *
  155.    * Will abort currently active loads.
  156.    *
  157.    * After the initial response, all event listeners will be cleared.
  158.    * Call open() before setting new event listeners.
  159.    *
  160.    * @param method The HTTP method, for example "POST" or "GET". Ignored
  161.    *               if the URL is not a HTTP(S) URL.
  162.    * @param url The URL to which to send the request.
  163.    * @param async Whether the request is synchronous or asynchronous
  164.    *              i.e. whether send returns only after the response
  165.    *              is received or if it returns immediately after
  166.    *              sending the request. In the latter case, notification
  167.    *              of completion is sent through the event listeners.
  168.    *              This argument must be true if the multipart
  169.    *              attribute has been set to true, or an exception will
  170.    *              be thrown.
  171.    * @param user A username for authentication if necessary.
  172.    * @param password A password for authentication if necessary.
  173.    */
  174.   /* [noscript] void openRequest (in AUTF8String method, in AUTF8String url, in boolean async, in AString user, in AString password); */
  175.   NS_IMETHOD OpenRequest(const nsACString & method, const nsACString & url, PRBool async, const nsAString & user, const nsAString & password) = 0;
  176.  
  177.   /**
  178.    * Meant to be a script-only method for initializing a request.
  179.    * The parameters are similar to the ones detailed in the
  180.    * description of <code>openRequest</code>, but the last
  181.    * 3 are optional.
  182.    *
  183.    * Will abort currently active loads.
  184.    *
  185.    * After the initial response, all event listeners will be cleared.
  186.    * Call open() before setting new event listeners.
  187.    *
  188.    * @param method The HTTP method - either "POST" or "GET". Ignored
  189.    *               if the URL is not a HTTP URL.
  190.    * @param url The URL to which to send the request.
  191.    * @param async (optional) Whether the request is synchronous or
  192.    *              asynchronous i.e. whether send returns only after
  193.    *              the response is received or if it returns immediately after
  194.    *              sending the request. In the latter case, notification
  195.    *              of completion is sent through the event listeners.
  196.    *              The default value is true.
  197.    *              This argument must be true if the multipart
  198.    *              attribute has been set to true, or an exception will
  199.    *              be thrown.
  200.    * @param user (optional) A username for authentication if necessary.
  201.    *             The default value is the empty string
  202.    * @param password (optional) A password for authentication if necessary.
  203.    *                 The default value is the empty string
  204.    */
  205.   /* void open (in AUTF8String method, in AUTF8String url); */
  206.   NS_IMETHOD Open(const nsACString & method, const nsACString & url) = 0;
  207.  
  208.   /**
  209.    * Sends the request. If the request is asynchronous, returns
  210.    * immediately after sending the request. If it is synchronous
  211.    * returns only after the response has been received.
  212.    *
  213.    * After the initial response, all event listeners will be cleared.
  214.    * Call open() before setting new event listeners.
  215.    *
  216.    * @param body Either an instance of nsIDOMDocument, nsIInputStream
  217.    *             or a string (nsISupportsString in the native calling
  218.    *             case). This is used to populate the body of the
  219.    *             HTTP request if the HTTP request method is "POST".
  220.    *             If the parameter is a nsIDOMDocument, it is serialized.
  221.    *             If the parameter is a nsIInputStream, then it must be
  222.    *             compatible with nsIUploadChannel.setUploadStream, and a
  223.    *             Content-Length header will be added to the HTTP request
  224.    *             with a value given by nsIInputStream.available.  Any
  225.    *             headers included at the top of the stream will be
  226.    *             treated as part of the message body.  The MIME type of
  227.    *             the stream should be specified by setting the Content-
  228.    *             Type header via the setRequestHeader method before
  229.    *             calling send.
  230.    */
  231.   /* void send (in nsIVariant body); */
  232.   NS_IMETHOD Send(nsIVariant *body) = 0;
  233.  
  234.   /**
  235.    * Sets a HTTP request header for HTTP requests. You must call open
  236.    * before setting the request headers.
  237.    *
  238.    * @param header The name of the header to set in the request.
  239.    * @param value The body of the header.
  240.    */
  241.   /* void setRequestHeader (in AUTF8String header, in AUTF8String value); */
  242.   NS_IMETHOD SetRequestHeader(const nsACString & header, const nsACString & value) = 0;
  243.  
  244.   /**
  245.    * The state of the request.
  246.    *
  247.    * Possible values:
  248.    *   0 UNINITIALIZED open() has not been called yet.
  249.    *   1 LOADING       send() has not been called yet.
  250.    *   2 LOADED        send() has been called, headers and status are available.
  251.    *   3 INTERACTIVE   Downloading, responseText holds the partial data.
  252.    *   4 COMPLETED     Finished with all operations.
  253.    */
  254.   /* readonly attribute long readyState; */
  255.   NS_IMETHOD GetReadyState(PRInt32 *aReadyState) = 0;
  256.  
  257.   /**
  258.    * Override the mime type returned by the server (if any). This may
  259.    * be used, for example, to force a stream to be treated and parsed
  260.    * as text/xml, even if the server does not report it as such. This
  261.    * must be done before the <code>send</code> method is invoked.
  262.    *
  263.    * @param mimetype The type used to override that returned by the server
  264.    *                 (if any).
  265.    */
  266.   /* void overrideMimeType (in AUTF8String mimetype); */
  267.   NS_IMETHOD OverrideMimeType(const nsACString & mimetype) = 0;
  268.  
  269.   /**
  270.    * Set to true if the response is expected to be a stream of
  271.    * possibly multiple (XML) documents. If set to true, the content
  272.    * type of the initial response must be multipart/x-mixed-replace or
  273.    * an error will be triggerd. All requests must be asynchronous.
  274.    *
  275.    * This enables server push. For each XML document that's written to
  276.    * this request, a new XML DOM document is created and the onload
  277.    * handler is called inbetween documents. Note that when this is
  278.    * set, the onload handler and other event handlers are not reset
  279.    * after the first XML document is loaded, and the onload handler
  280.    * will be called as each part of the response is received.
  281.    */
  282.   /* attribute boolean multipart; */
  283.   NS_IMETHOD GetMultipart(PRBool *aMultipart) = 0;
  284.   NS_IMETHOD SetMultipart(PRBool aMultipart) = 0;
  285.  
  286. };
  287.  
  288. /* Use this macro when declaring classes that implement this interface. */
  289. #define NS_DECL_NSIXMLHTTPREQUEST \
  290.   NS_IMETHOD GetChannel(nsIChannel * *aChannel); \
  291.   NS_IMETHOD GetResponseXML(nsIDOMDocument * *aResponseXML); \
  292.   NS_IMETHOD GetResponseText(nsAString & aResponseText); \
  293.   NS_IMETHOD GetStatus(PRUint32 *aStatus); \
  294.   NS_IMETHOD GetStatusText(nsACString & aStatusText); \
  295.   NS_IMETHOD Abort(void); \
  296.   NS_IMETHOD GetAllResponseHeaders(char **_retval); \
  297.   NS_IMETHOD GetResponseHeader(const nsACString & header, nsACString & _retval); \
  298.   NS_IMETHOD OpenRequest(const nsACString & method, const nsACString & url, PRBool async, const nsAString & user, const nsAString & password); \
  299.   NS_IMETHOD Open(const nsACString & method, const nsACString & url); \
  300.   NS_IMETHOD Send(nsIVariant *body); \
  301.   NS_IMETHOD SetRequestHeader(const nsACString & header, const nsACString & value); \
  302.   NS_IMETHOD GetReadyState(PRInt32 *aReadyState); \
  303.   NS_IMETHOD OverrideMimeType(const nsACString & mimetype); \
  304.   NS_IMETHOD GetMultipart(PRBool *aMultipart); \
  305.   NS_IMETHOD SetMultipart(PRBool aMultipart); 
  306.  
  307. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  308. #define NS_FORWARD_NSIXMLHTTPREQUEST(_to) \
  309.   NS_IMETHOD GetChannel(nsIChannel * *aChannel) { return _to GetChannel(aChannel); } \
  310.   NS_IMETHOD GetResponseXML(nsIDOMDocument * *aResponseXML) { return _to GetResponseXML(aResponseXML); } \
  311.   NS_IMETHOD GetResponseText(nsAString & aResponseText) { return _to GetResponseText(aResponseText); } \
  312.   NS_IMETHOD GetStatus(PRUint32 *aStatus) { return _to GetStatus(aStatus); } \
  313.   NS_IMETHOD GetStatusText(nsACString & aStatusText) { return _to GetStatusText(aStatusText); } \
  314.   NS_IMETHOD Abort(void) { return _to Abort(); } \
  315.   NS_IMETHOD GetAllResponseHeaders(char **_retval) { return _to GetAllResponseHeaders(_retval); } \
  316.   NS_IMETHOD GetResponseHeader(const nsACString & header, nsACString & _retval) { return _to GetResponseHeader(header, _retval); } \
  317.   NS_IMETHOD OpenRequest(const nsACString & method, const nsACString & url, PRBool async, const nsAString & user, const nsAString & password) { return _to OpenRequest(method, url, async, user, password); } \
  318.   NS_IMETHOD Open(const nsACString & method, const nsACString & url) { return _to Open(method, url); } \
  319.   NS_IMETHOD Send(nsIVariant *body) { return _to Send(body); } \
  320.   NS_IMETHOD SetRequestHeader(const nsACString & header, const nsACString & value) { return _to SetRequestHeader(header, value); } \
  321.   NS_IMETHOD GetReadyState(PRInt32 *aReadyState) { return _to GetReadyState(aReadyState); } \
  322.   NS_IMETHOD OverrideMimeType(const nsACString & mimetype) { return _to OverrideMimeType(mimetype); } \
  323.   NS_IMETHOD GetMultipart(PRBool *aMultipart) { return _to GetMultipart(aMultipart); } \
  324.   NS_IMETHOD SetMultipart(PRBool aMultipart) { return _to SetMultipart(aMultipart); } 
  325.  
  326. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  327. #define NS_FORWARD_SAFE_NSIXMLHTTPREQUEST(_to) \
  328.   NS_IMETHOD GetChannel(nsIChannel * *aChannel) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetChannel(aChannel); } \
  329.   NS_IMETHOD GetResponseXML(nsIDOMDocument * *aResponseXML) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetResponseXML(aResponseXML); } \
  330.   NS_IMETHOD GetResponseText(nsAString & aResponseText) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetResponseText(aResponseText); } \
  331.   NS_IMETHOD GetStatus(PRUint32 *aStatus) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetStatus(aStatus); } \
  332.   NS_IMETHOD GetStatusText(nsACString & aStatusText) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetStatusText(aStatusText); } \
  333.   NS_IMETHOD Abort(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Abort(); } \
  334.   NS_IMETHOD GetAllResponseHeaders(char **_retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetAllResponseHeaders(_retval); } \
  335.   NS_IMETHOD GetResponseHeader(const nsACString & header, nsACString & _retval) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetResponseHeader(header, _retval); } \
  336.   NS_IMETHOD OpenRequest(const nsACString & method, const nsACString & url, PRBool async, const nsAString & user, const nsAString & password) { return !_to ? NS_ERROR_NULL_POINTER : _to->OpenRequest(method, url, async, user, password); } \
  337.   NS_IMETHOD Open(const nsACString & method, const nsACString & url) { return !_to ? NS_ERROR_NULL_POINTER : _to->Open(method, url); } \
  338.   NS_IMETHOD Send(nsIVariant *body) { return !_to ? NS_ERROR_NULL_POINTER : _to->Send(body); } \
  339.   NS_IMETHOD SetRequestHeader(const nsACString & header, const nsACString & value) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetRequestHeader(header, value); } \
  340.   NS_IMETHOD GetReadyState(PRInt32 *aReadyState) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetReadyState(aReadyState); } \
  341.   NS_IMETHOD OverrideMimeType(const nsACString & mimetype) { return !_to ? NS_ERROR_NULL_POINTER : _to->OverrideMimeType(mimetype); } \
  342.   NS_IMETHOD GetMultipart(PRBool *aMultipart) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetMultipart(aMultipart); } \
  343.   NS_IMETHOD SetMultipart(PRBool aMultipart) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetMultipart(aMultipart); } 
  344.  
  345. #if 0
  346. /* Use the code below as a template for the implementation class for this interface. */
  347.  
  348. /* Header file */
  349. class nsXMLHttpRequest : public nsIXMLHttpRequest
  350. {
  351. public:
  352.   NS_DECL_ISUPPORTS
  353.   NS_DECL_NSIXMLHTTPREQUEST
  354.  
  355.   nsXMLHttpRequest();
  356.  
  357. private:
  358.   ~nsXMLHttpRequest();
  359.  
  360. protected:
  361.   /* additional members */
  362. };
  363.  
  364. /* Implementation file */
  365. NS_IMPL_ISUPPORTS1(nsXMLHttpRequest, nsIXMLHttpRequest)
  366.  
  367. nsXMLHttpRequest::nsXMLHttpRequest()
  368. {
  369.   /* member initializers and constructor code */
  370. }
  371.  
  372. nsXMLHttpRequest::~nsXMLHttpRequest()
  373. {
  374.   /* destructor code */
  375. }
  376.  
  377. /* readonly attribute nsIChannel channel; */
  378. NS_IMETHODIMP nsXMLHttpRequest::GetChannel(nsIChannel * *aChannel)
  379. {
  380.     return NS_ERROR_NOT_IMPLEMENTED;
  381. }
  382.  
  383. /* readonly attribute nsIDOMDocument responseXML; */
  384. NS_IMETHODIMP nsXMLHttpRequest::GetResponseXML(nsIDOMDocument * *aResponseXML)
  385. {
  386.     return NS_ERROR_NOT_IMPLEMENTED;
  387. }
  388.  
  389. /* readonly attribute AString responseText; */
  390. NS_IMETHODIMP nsXMLHttpRequest::GetResponseText(nsAString & aResponseText)
  391. {
  392.     return NS_ERROR_NOT_IMPLEMENTED;
  393. }
  394.  
  395. /* readonly attribute unsigned long status; */
  396. NS_IMETHODIMP nsXMLHttpRequest::GetStatus(PRUint32 *aStatus)
  397. {
  398.     return NS_ERROR_NOT_IMPLEMENTED;
  399. }
  400.  
  401. /* readonly attribute AUTF8String statusText; */
  402. NS_IMETHODIMP nsXMLHttpRequest::GetStatusText(nsACString & aStatusText)
  403. {
  404.     return NS_ERROR_NOT_IMPLEMENTED;
  405. }
  406.  
  407. /* void abort (); */
  408. NS_IMETHODIMP nsXMLHttpRequest::Abort()
  409. {
  410.     return NS_ERROR_NOT_IMPLEMENTED;
  411. }
  412.  
  413. /* string getAllResponseHeaders (); */
  414. NS_IMETHODIMP nsXMLHttpRequest::GetAllResponseHeaders(char **_retval)
  415. {
  416.     return NS_ERROR_NOT_IMPLEMENTED;
  417. }
  418.  
  419. /* ACString getResponseHeader (in AUTF8String header); */
  420. NS_IMETHODIMP nsXMLHttpRequest::GetResponseHeader(const nsACString & header, nsACString & _retval)
  421. {
  422.     return NS_ERROR_NOT_IMPLEMENTED;
  423. }
  424.  
  425. /* [noscript] void openRequest (in AUTF8String method, in AUTF8String url, in boolean async, in AString user, in AString password); */
  426. NS_IMETHODIMP nsXMLHttpRequest::OpenRequest(const nsACString & method, const nsACString & url, PRBool async, const nsAString & user, const nsAString & password)
  427. {
  428.     return NS_ERROR_NOT_IMPLEMENTED;
  429. }
  430.  
  431. /* void open (in AUTF8String method, in AUTF8String url); */
  432. NS_IMETHODIMP nsXMLHttpRequest::Open(const nsACString & method, const nsACString & url)
  433. {
  434.     return NS_ERROR_NOT_IMPLEMENTED;
  435. }
  436.  
  437. /* void send (in nsIVariant body); */
  438. NS_IMETHODIMP nsXMLHttpRequest::Send(nsIVariant *body)
  439. {
  440.     return NS_ERROR_NOT_IMPLEMENTED;
  441. }
  442.  
  443. /* void setRequestHeader (in AUTF8String header, in AUTF8String value); */
  444. NS_IMETHODIMP nsXMLHttpRequest::SetRequestHeader(const nsACString & header, const nsACString & value)
  445. {
  446.     return NS_ERROR_NOT_IMPLEMENTED;
  447. }
  448.  
  449. /* readonly attribute long readyState; */
  450. NS_IMETHODIMP nsXMLHttpRequest::GetReadyState(PRInt32 *aReadyState)
  451. {
  452.     return NS_ERROR_NOT_IMPLEMENTED;
  453. }
  454.  
  455. /* void overrideMimeType (in AUTF8String mimetype); */
  456. NS_IMETHODIMP nsXMLHttpRequest::OverrideMimeType(const nsACString & mimetype)
  457. {
  458.     return NS_ERROR_NOT_IMPLEMENTED;
  459. }
  460.  
  461. /* attribute boolean multipart; */
  462. NS_IMETHODIMP nsXMLHttpRequest::GetMultipart(PRBool *aMultipart)
  463. {
  464.     return NS_ERROR_NOT_IMPLEMENTED;
  465. }
  466. NS_IMETHODIMP nsXMLHttpRequest::SetMultipart(PRBool aMultipart)
  467. {
  468.     return NS_ERROR_NOT_IMPLEMENTED;
  469. }
  470.  
  471. /* End of implementation class template. */
  472. #endif
  473.  
  474.  
  475. /* starting interface:    nsIOnReadyStateChangeHandler */
  476. #define NS_IONREADYSTATECHANGEHANDLER_IID_STR "6459b7ce-6b57-4934-a0af-0133ba6f9085"
  477.  
  478. #define NS_IONREADYSTATECHANGEHANDLER_IID \
  479.   {0x6459b7ce, 0x6b57, 0x4934, \
  480.     { 0xa0, 0xaf, 0x01, 0x33, 0xba, 0x6f, 0x90, 0x85 }}
  481.  
  482. class NS_NO_VTABLE nsIOnReadyStateChangeHandler : public nsISupports {
  483.  public: 
  484.  
  485.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IONREADYSTATECHANGEHANDLER_IID)
  486.  
  487.   /**
  488.    * Helper to implement the onreadystatechange callback member.
  489.    * You should not need to use this.
  490.    */
  491.   /* void handleEvent (); */
  492.   NS_IMETHOD HandleEvent(void) = 0;
  493.  
  494. };
  495.  
  496. /* Use this macro when declaring classes that implement this interface. */
  497. #define NS_DECL_NSIONREADYSTATECHANGEHANDLER \
  498.   NS_IMETHOD HandleEvent(void); 
  499.  
  500. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  501. #define NS_FORWARD_NSIONREADYSTATECHANGEHANDLER(_to) \
  502.   NS_IMETHOD HandleEvent(void) { return _to HandleEvent(); } 
  503.  
  504. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  505. #define NS_FORWARD_SAFE_NSIONREADYSTATECHANGEHANDLER(_to) \
  506.   NS_IMETHOD HandleEvent(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->HandleEvent(); } 
  507.  
  508. #if 0
  509. /* Use the code below as a template for the implementation class for this interface. */
  510.  
  511. /* Header file */
  512. class nsOnReadyStateChangeHandler : public nsIOnReadyStateChangeHandler
  513. {
  514. public:
  515.   NS_DECL_ISUPPORTS
  516.   NS_DECL_NSIONREADYSTATECHANGEHANDLER
  517.  
  518.   nsOnReadyStateChangeHandler();
  519.  
  520. private:
  521.   ~nsOnReadyStateChangeHandler();
  522.  
  523. protected:
  524.   /* additional members */
  525. };
  526.  
  527. /* Implementation file */
  528. NS_IMPL_ISUPPORTS1(nsOnReadyStateChangeHandler, nsIOnReadyStateChangeHandler)
  529.  
  530. nsOnReadyStateChangeHandler::nsOnReadyStateChangeHandler()
  531. {
  532.   /* member initializers and constructor code */
  533. }
  534.  
  535. nsOnReadyStateChangeHandler::~nsOnReadyStateChangeHandler()
  536. {
  537.   /* destructor code */
  538. }
  539.  
  540. /* void handleEvent (); */
  541. NS_IMETHODIMP nsOnReadyStateChangeHandler::HandleEvent()
  542. {
  543.     return NS_ERROR_NOT_IMPLEMENTED;
  544. }
  545.  
  546. /* End of implementation class template. */
  547. #endif
  548.  
  549.  
  550. /* starting interface:    nsIJSXMLHttpRequest */
  551. #define NS_IJSXMLHTTPREQUEST_IID_STR "9deabc90-28d5-41d3-a660-474f2254f4ba"
  552.  
  553. #define NS_IJSXMLHTTPREQUEST_IID \
  554.   {0x9deabc90, 0x28d5, 0x41d3, \
  555.     { 0xa6, 0x60, 0x47, 0x4f, 0x22, 0x54, 0xf4, 0xba }}
  556.  
  557. class NS_NO_VTABLE nsIJSXMLHttpRequest : public nsISupports {
  558.  public: 
  559.  
  560.   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IJSXMLHTTPREQUEST_IID)
  561.  
  562.   /**
  563.    * Meant to be a script-only mechanism for setting a load event listener.
  564.    * The attribute is expected to be JavaScript function object. When
  565.    * the load event occurs, the function is invoked.
  566.    * This attribute should not be used from native code!!
  567.    *
  568.    * After the initial response, all event listeners will be cleared.
  569.    * Call open() before setting new event listeners.
  570.    *
  571.    * Mozilla only.
  572.    */
  573.   /* attribute nsIDOMEventListener onload; */
  574.   NS_IMETHOD GetOnload(nsIDOMEventListener * *aOnload) = 0;
  575.   NS_IMETHOD SetOnload(nsIDOMEventListener * aOnload) = 0;
  576.  
  577.   /**
  578.    * Meant to be a script-only mechanism for setting an error event listener.
  579.    * The attribute is expected to be JavaScript function object. When
  580.    * the error event occurs, the function is invoked.
  581.    * This attribute should not be used from native code!!
  582.    *
  583.    * After the initial response, all event listeners will be cleared.
  584.    * Call open() before setting new event listeners.
  585.    *
  586.    * Mozilla only.
  587.    */
  588.   /* attribute nsIDOMEventListener onerror; */
  589.   NS_IMETHOD GetOnerror(nsIDOMEventListener * *aOnerror) = 0;
  590.   NS_IMETHOD SetOnerror(nsIDOMEventListener * aOnerror) = 0;
  591.  
  592.   /**
  593.    * Meant to be a script-only mechanism for setting a progress event listener.
  594.    * The attribute is expected to be JavaScript function object. When
  595.    * the error event occurs, the function is invoked.
  596.    * This attribute should not be used from native code!!
  597.    * This event listener may be called multiple times during the open request.
  598.    *
  599.    * After the initial response, all event listeners will be cleared.
  600.    * Call open() before setting new event listeners.
  601.    *
  602.    * Mozilla only.
  603.    */
  604.   /* attribute nsIDOMEventListener onprogress; */
  605.   NS_IMETHOD GetOnprogress(nsIDOMEventListener * *aOnprogress) = 0;
  606.   NS_IMETHOD SetOnprogress(nsIDOMEventListener * aOnprogress) = 0;
  607.  
  608.   /**
  609.    * Meant to be a script-only mechanism for setting a callback function.
  610.    * The attribute is expected to be JavaScript function object. When the
  611.    * readyState changes, the callback function will be called.
  612.    * This attribute should not be used from native code!!
  613.    *
  614.    * After the initial response, all event listeners will be cleared.
  615.    * Call open() before setting new event listeners.
  616.    */
  617.   /* attribute nsIOnReadyStateChangeHandler onreadystatechange; */
  618.   NS_IMETHOD GetOnreadystatechange(nsIOnReadyStateChangeHandler * *aOnreadystatechange) = 0;
  619.   NS_IMETHOD SetOnreadystatechange(nsIOnReadyStateChangeHandler * aOnreadystatechange) = 0;
  620.  
  621. };
  622.  
  623. /* Use this macro when declaring classes that implement this interface. */
  624. #define NS_DECL_NSIJSXMLHTTPREQUEST \
  625.   NS_IMETHOD GetOnload(nsIDOMEventListener * *aOnload); \
  626.   NS_IMETHOD SetOnload(nsIDOMEventListener * aOnload); \
  627.   NS_IMETHOD GetOnerror(nsIDOMEventListener * *aOnerror); \
  628.   NS_IMETHOD SetOnerror(nsIDOMEventListener * aOnerror); \
  629.   NS_IMETHOD GetOnprogress(nsIDOMEventListener * *aOnprogress); \
  630.   NS_IMETHOD SetOnprogress(nsIDOMEventListener * aOnprogress); \
  631.   NS_IMETHOD GetOnreadystatechange(nsIOnReadyStateChangeHandler * *aOnreadystatechange); \
  632.   NS_IMETHOD SetOnreadystatechange(nsIOnReadyStateChangeHandler * aOnreadystatechange); 
  633.  
  634. /* Use this macro to declare functions that forward the behavior of this interface to another object. */
  635. #define NS_FORWARD_NSIJSXMLHTTPREQUEST(_to) \
  636.   NS_IMETHOD GetOnload(nsIDOMEventListener * *aOnload) { return _to GetOnload(aOnload); } \
  637.   NS_IMETHOD SetOnload(nsIDOMEventListener * aOnload) { return _to SetOnload(aOnload); } \
  638.   NS_IMETHOD GetOnerror(nsIDOMEventListener * *aOnerror) { return _to GetOnerror(aOnerror); } \
  639.   NS_IMETHOD SetOnerror(nsIDOMEventListener * aOnerror) { return _to SetOnerror(aOnerror); } \
  640.   NS_IMETHOD GetOnprogress(nsIDOMEventListener * *aOnprogress) { return _to GetOnprogress(aOnprogress); } \
  641.   NS_IMETHOD SetOnprogress(nsIDOMEventListener * aOnprogress) { return _to SetOnprogress(aOnprogress); } \
  642.   NS_IMETHOD GetOnreadystatechange(nsIOnReadyStateChangeHandler * *aOnreadystatechange) { return _to GetOnreadystatechange(aOnreadystatechange); } \
  643.   NS_IMETHOD SetOnreadystatechange(nsIOnReadyStateChangeHandler * aOnreadystatechange) { return _to SetOnreadystatechange(aOnreadystatechange); } 
  644.  
  645. /* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
  646. #define NS_FORWARD_SAFE_NSIJSXMLHTTPREQUEST(_to) \
  647.   NS_IMETHOD GetOnload(nsIDOMEventListener * *aOnload) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOnload(aOnload); } \
  648.   NS_IMETHOD SetOnload(nsIDOMEventListener * aOnload) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOnload(aOnload); } \
  649.   NS_IMETHOD GetOnerror(nsIDOMEventListener * *aOnerror) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOnerror(aOnerror); } \
  650.   NS_IMETHOD SetOnerror(nsIDOMEventListener * aOnerror) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOnerror(aOnerror); } \
  651.   NS_IMETHOD GetOnprogress(nsIDOMEventListener * *aOnprogress) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOnprogress(aOnprogress); } \
  652.   NS_IMETHOD SetOnprogress(nsIDOMEventListener * aOnprogress) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOnprogress(aOnprogress); } \
  653.   NS_IMETHOD GetOnreadystatechange(nsIOnReadyStateChangeHandler * *aOnreadystatechange) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetOnreadystatechange(aOnreadystatechange); } \
  654.   NS_IMETHOD SetOnreadystatechange(nsIOnReadyStateChangeHandler * aOnreadystatechange) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetOnreadystatechange(aOnreadystatechange); } 
  655.  
  656. #if 0
  657. /* Use the code below as a template for the implementation class for this interface. */
  658.  
  659. /* Header file */
  660. class nsJSXMLHttpRequest : public nsIJSXMLHttpRequest
  661. {
  662. public:
  663.   NS_DECL_ISUPPORTS
  664.   NS_DECL_NSIJSXMLHTTPREQUEST
  665.  
  666.   nsJSXMLHttpRequest();
  667.  
  668. private:
  669.   ~nsJSXMLHttpRequest();
  670.  
  671. protected:
  672.   /* additional members */
  673. };
  674.  
  675. /* Implementation file */
  676. NS_IMPL_ISUPPORTS1(nsJSXMLHttpRequest, nsIJSXMLHttpRequest)
  677.  
  678. nsJSXMLHttpRequest::nsJSXMLHttpRequest()
  679. {
  680.   /* member initializers and constructor code */
  681. }
  682.  
  683. nsJSXMLHttpRequest::~nsJSXMLHttpRequest()
  684. {
  685.   /* destructor code */
  686. }
  687.  
  688. /* attribute nsIDOMEventListener onload; */
  689. NS_IMETHODIMP nsJSXMLHttpRequest::GetOnload(nsIDOMEventListener * *aOnload)
  690. {
  691.     return NS_ERROR_NOT_IMPLEMENTED;
  692. }
  693. NS_IMETHODIMP nsJSXMLHttpRequest::SetOnload(nsIDOMEventListener * aOnload)
  694. {
  695.     return NS_ERROR_NOT_IMPLEMENTED;
  696. }
  697.  
  698. /* attribute nsIDOMEventListener onerror; */
  699. NS_IMETHODIMP nsJSXMLHttpRequest::GetOnerror(nsIDOMEventListener * *aOnerror)
  700. {
  701.     return NS_ERROR_NOT_IMPLEMENTED;
  702. }
  703. NS_IMETHODIMP nsJSXMLHttpRequest::SetOnerror(nsIDOMEventListener * aOnerror)
  704. {
  705.     return NS_ERROR_NOT_IMPLEMENTED;
  706. }
  707.  
  708. /* attribute nsIDOMEventListener onprogress; */
  709. NS_IMETHODIMP nsJSXMLHttpRequest::GetOnprogress(nsIDOMEventListener * *aOnprogress)
  710. {
  711.     return NS_ERROR_NOT_IMPLEMENTED;
  712. }
  713. NS_IMETHODIMP nsJSXMLHttpRequest::SetOnprogress(nsIDOMEventListener * aOnprogress)
  714. {
  715.     return NS_ERROR_NOT_IMPLEMENTED;
  716. }
  717.  
  718. /* attribute nsIOnReadyStateChangeHandler onreadystatechange; */
  719. NS_IMETHODIMP nsJSXMLHttpRequest::GetOnreadystatechange(nsIOnReadyStateChangeHandler * *aOnreadystatechange)
  720. {
  721.     return NS_ERROR_NOT_IMPLEMENTED;
  722. }
  723. NS_IMETHODIMP nsJSXMLHttpRequest::SetOnreadystatechange(nsIOnReadyStateChangeHandler * aOnreadystatechange)
  724. {
  725.     return NS_ERROR_NOT_IMPLEMENTED;
  726. }
  727.  
  728. /* End of implementation class template. */
  729. #endif
  730.  
  731. #define NS_XMLHTTPREQUEST_CID                       \
  732.  { /* d164e770-4157-11d4-9a42-000064657374 */       \
  733.   0xd164e770, 0x4157, 0x11d4,                       \
  734.  {0x9a, 0x42, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74} }
  735. #define NS_XMLHTTPREQUEST_CONTRACTID \
  736. "@mozilla.org/xmlextras/xmlhttprequest;1"
  737.  
  738. #endif /* __gen_nsIXMLHttpRequest_h__ */
  739.